package com.r2coding.music.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.r2coding.music.entity.SongSongListEntity;
import com.r2coding.music.service.SongSongListService;
import com.r2coding.common.util.PageUtils;
import com.r2coding.common.util.Result;

/**
 * 歌曲与歌单关系
 *
 * @author 98k灬
 * @email hk666zx@163.com
 * @date 2022-05-04 20:46:11
 */
@RestController
@RequestMapping("/songsongList")
public class SongSongListController {
    @Autowired
    private SongSongListService songListService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtils page = songListService.queryPage(params);
        return Result.ok();
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{songId}")
    public Result info(@PathVariable("songId") Integer songId){
		SongSongListEntity songSongSheet = songListService.getById(songId);
        return Result.ok();
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody SongSongListEntity songSongSheet){
        songListService.save(songSongSheet);
        return Result.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody SongSongListEntity songSongSheet){
        songListService.updateById(songSongSheet);
        return Result.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Integer[] songIds){
        songListService.removeByIds(Arrays.asList(songIds));
        return Result.ok();
    }

}
